package com.hwy.catering;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.io.IOException;

@SpringBootApplication
//接口扫描
@MapperScan("com.hwy.catering.mapper")
@EnableTransactionManagement
public class CateringApplication {

    public static void main(String[] args) {
        SpringApplication.run(CateringApplication.class, args);
    }

    @Autowired
    private RestHighLevelClient client;

    void testCreateClient() throws IOException {
        HttpHost host = HttpHost.create("http://127.0.0.1:9201");
        RestClientBuilder builder = RestClient.builder(host);
        client = new RestHighLevelClient(builder);
        client.close();
    }
}
